using System;
using System.Collections.Generic;

namespace DA.AnimGraph {
    public interface INode {
    }

    public interface INodeSetupData {
    }

    // 有子节点就需要在内部定义此类型
    internal unsafe struct NodeHead {
        public int childrenCount;

        //public NodeLink* selfLink;
        public NodeLink** children;
        public float* weights;

        public NodeHead(NodeLink* link) {
            //selfLink = link;
            childrenCount = link->childrenCount;
            children = (NodeLink**)link->children.GetUnsafePtr();
            weights = (float*)link->weights.GetUnsafePtr();
        }

        public float GetWeight(int index) {
            return weights[index];
        }

        public float GetLastWeight(int index) {
            return weights[index + childrenCount];
        }

        public bool IsExit(int index) {
            return weights[index] == 0 && weights[index + childrenCount] != 0;
        }
    }

}
